﻿using System;
using System.Linq.Expressions;
using ilgolosone.DomainModel.Entities;
using ilgolosone.Shared.Domain;

namespace ilgolosone.DomainModel.Queries
{
    public class FindRestaurantByName : IDomainQuery<Restaurant>
    {
        protected readonly string _restaurantName;

        public FindRestaurantByName(string restaurantName)
        {
            _restaurantName = restaurantName;
        }

        public virtual Expression<Func<Restaurant, bool>> Criteria
        {
            get { return restaurant => restaurant.RestaurantName == _restaurantName; }
        }
    }

    public class FindRestaurantByPartOfName : FindRestaurantByName
    {
        public FindRestaurantByPartOfName(string namePart)
            : base(namePart)
        { }

        public override Expression<Func<Restaurant, bool>> Criteria
        {
            get { return restaurant => restaurant.RestaurantName.Contains(_restaurantName); }
        }
    }
}
